unit biblio;

interface

uses SysUtils;

function Kod_otd(BBK: string): integer;
function Kod_otd1(BBK: PChar): integer;

implementation

function Kod_otd(BBK: string): integer;
var
  d1, d2: integer;
begin
  result := 0;
  d1 := StrToInt(BBK[1]);
  d2 := StrToInt(Copy(BBK, 1, 2));
  if (d1 in [1,6,7,8,9]) then result := 1;
  if (d1 in [2,5]) then result := 2;
  if (d1 in [3,4]) then result := 3;
  if (d2 in [75,85]) then result := 4;
  if (d2 in [80,81,82,83,84]) then result := 5;
end;

function Kod_otd1(BBK: PChar): integer;
var
  d1, d2: integer;
begin
  result := 0;
  d1 := StrToInt(Copy(BBK, 1, 1));
  d2 := StrToInt(Copy(BBK, 1, 2));
  if (d1 in [1,6,7,8,9]) then result := 1;
  if (d1 in [2,5]) then result := 2;
  if (d1 in [3,4]) then result := 3;
  if (d2 in [75,85]) then result := 4;
  if (d2 in [80,81,82,83,84]) then result := 5;
end;

end.
